home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / circuits / pcb-1.000 / pcb-1 / pcb-1.3 / mymem.h < prev    next >
C/C++ Source or Header  |  1995-02-26  |  3KB  |  89 lines

  1. /*
  2.  *                            COPYRIGHT
  3.  *
  4.  *  PCB, interactive printed circuit board design
  5.  *  Copyright (C) 1994,1995 Thomas Nau
  6.  *
  7.  *  This program is free software; you can redistribute it and/or modify
  8.  *  it under the terms of the GNU General Public License as published by
  9.  *  the Free Software Foundation; either version 2 of the License, or
  10.  *  (at your option) any later version.
  11.  *
  12.  *  This program is distributed in the hope that it will be useful,
  13.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *  GNU General Public License for more details.
  16.  *
  17.  *  You should have received a copy of the GNU General Public License
  18.  *  along with this program; if not, write to the Free Software
  19.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  *  Contact addresses for paper mail and Email:
  22.  *  Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
  23.  *  Thomas.Nau@rz.uni-ulm.de
  24.  *
  25.  *  RCS: $Header$
  26.  */
  27.  
  28. /* prototypes for memory routines
  29.  */
  30.  
  31. #ifndef    __MYMEM_INCLUDED__
  32. #define    __MYMEM_INCLUDED__
  33.  
  34. #include <stdlib.h>
  35. #include "global.h"
  36.  
  37. /* ---------------------------------------------------------------------------
  38.  * number of additional objects that are allocated with one system call
  39.  */
  40. #define    STEP_VIA            500        /* block size for realloc() calls */
  41. #define    STEP_PIN            30
  42. #define    STEP_LINE            500
  43. #define    STEP_ELEMENTLINE    20
  44. #define    STEP_ELEMENTARC        5
  45. #define    STEP_TEXT            50
  46. #define    STEP_ELEMENT        50
  47. #define    STEP_SYMBOLLINE        10
  48. #define    STEP_FILENAME        500
  49. #define    STEP_REMOVELIST        500
  50. #define    STEP_UNDOLIST        500
  51. #define    STEP_POLYGON        10
  52. #define    STEP_POLYGONPOINT    10
  53.  
  54. /* ---------------------------------------------------------------------------
  55.  * some memory types
  56.  */
  57. typedef struct
  58. {
  59.     size_t    MaxLength;
  60.     char    *Data;
  61. } DynamicStringType, *DynamicStringTypePtr;
  62.  
  63. PinTypePtr            GetPinMemory(ElementTypePtr);
  64. PinTypePtr            GetViaMemory(DataTypePtr);
  65. LineTypePtr            GetLineMemory(LayerTypePtr);
  66. TextTypePtr            GetTextMemory(LayerTypePtr);
  67. PolygonTypePtr        GetPolygonMemory(LayerTypePtr);
  68. PolygonPointTypePtr    GetPointMemoryInPolygon(PolygonTypePtr);
  69. ElementTypePtr        GetElementMemory(DataTypePtr);
  70. void                *MyCalloc(size_t, size_t, char *);
  71. void                *MyRealloc(void *, size_t, char *);
  72. char                *MyStrdup(char *s, char *);
  73. void                MyFree(char **);
  74. void                FreePolygonMemory(PolygonTypePtr);
  75. void                FreeElementMemory(ElementTypePtr);
  76. void                FreePCBMemory(PCBTypePtr);
  77. void                FreeDataMemory(DataTypePtr);
  78. void                SaveFree(void *);
  79. void                DSAddCharacter(DynamicStringTypePtr, char);
  80. void                DSAddString(DynamicStringTypePtr, char *);
  81. void                DSClearString(DynamicStringTypePtr);
  82. char                *StripWhiteSpaceAndDup(char *);
  83.  
  84. #ifdef NEED_STRDUP
  85. char                strdup(const char *);
  86. #endif
  87.  
  88. #endif
  89.